package beans;
 
import daos.TimeDAO;
import entitys.Time;
import java.util.List;
import javax.faces.bean.ManagedBean;

/**
 *
 * @author Amauri
 */
@ManagedBean
public class TimeBean {
    
    private Time time;
    private TimeDAO dao;

    public TimeBean(){
        this.dao = new TimeDAO();
        this.time = new Time();
    }
    
    public List<Time> getAll(){
        return this.getDao().listAll();
    }
    
    public Time getTime() {
        return time;
    }
    
    public String salvar(){
        this.getDao().persistir(this.getTime());
        return "time_listar";
    }
    
    public String alterar(Time time){
        this.setTime(time);
        return "cadastro_time";
    }
    
    public String excluir(Time time){
        this.getDao().delete(time);
        return null;
    }

    public void setTime(Time time) {
        this.time = time;
    }

    public TimeDAO getDao() {
        return dao;
    }

    public void setDao(TimeDAO dao) {
        this.dao = dao;
    }
}